/**
 * Created by yanghaijin on 2018/5/12.
 */
// components/applifecycle.js
module.exports = function (app, opts) {
    return new applifecycle(app, opts);
};

var applifecycle = function (app, opts) {
    this.app = app;
    this.interval = opts.interval | 1000;
};

applifecycle.name = "applifecycle";

applifecycle.prototype.start = function (cb) {
    console.log("applifecycle start");
    cb();
};

applifecycle.prototype.afterStart = function (cb) {
    console.log("applifecycle afterStart");
    // var DB_URL = "mongodb://localhost:27017/chm";
    // var DB_NAME = "chess";
    // var MongoDBUtil = require("./../util/MongoDBUtil");
    // MongoDBUtil.connectMongoDB(DB_URL, DB_NAME);
    cb();
};

applifecycle.prototype.stop = function (force, cb) {
    console.log("applifecycle stop");
    cb();
};